import Vue from 'vue'
import Router from 'vue-router'
import index from '../pages/index'
import list from '../pages/list'
import car from '../pages/car'
import mine from '../pages/mine'
import login from '../pages/login'
import search_page from '../pages/search'
import register from '../pages/register'
import product_detail from '../pages/product-detail'
import order from '../pages/order'
import user_info from '../pages/userinfo'
import about from '../pages/about'
import help from '../pages/help'
import complete from "../pages/complete"
import collection from "../pages/collection";

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      name: 'index',
      component: index,
      meta: {
        keepAlive: true,
        requiresAuth: false
      }
    },
    {
      path: '/list',
      name: 'list',
      component: list,
      meta: {
        keepAlive: true,
        requiresAuth: false
      }
    },
    {
      path: '/car',
      name: 'car',
      component: car,
      meta: {
        keepAlive: false,
        requiresAuth: true
      }
    },
    {
      path: '/mine',
      name: 'mine',
      component: mine,
      meta: {
        keepAlive: false,
        requiresAuth: true
      }
    },
    {
        path: '/about',
        name: 'about',
        component: about,
        meta: {
            keepAlive: true,
            requiresAuth: true
        }
    },
    {
        path: '/help',
        name: 'help',
        component: help,
        meta: {
            keepAlive: true,
            requiresAuth: true
        }
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {
        keepAlive: true,
        requiresAuth: false
      }
    },
    {
      path: '/register',
      name: 'register',
      component: register,
      meta: {
        keepAlive: false,
        requiresAuth: false
      }
    },
    {
      path: '/product-detail',
      name: 'product-detail',
      component: product_detail,
      meta: {
        keepAlive: false,
        requiresAuth: true
      }
    },
      {
          path: '/search',
          name: 'search_page',
          component: search_page,
          meta: {
              keepAlive: false,
              requiresAuth: false
          }
      },
      {
          path: '/order',
          name: 'order',
          component: order,
          meta: {
              keepAlive: false,
              requiresAuth: true
          }
      },
      {
          path: '/userinfo',
          name: 'userinfo',
          component: user_info,
          meta: {
              keepAlive: false,
              requiresAuth: true
          }
      },
      {
          path: '/complete',
          name: 'complete',
          component: complete,
          meta: {
              keepAlive: false,
              requiresAuth: true
          }
      },
      {
          path: '/collection',
          name: 'collection',
          component: collection,
          meta: {
              keepAlive: false,
              requiresAuth: true
          }
      }
  ]
})
